function LayPage(tab,totalPage,totalRow,pageNumber,pageSize,fn,arr){
	layui.use(['laypage'], function(){
		var laypage = layui.laypage;
		
		$("#tabPage").remove();
		var div = document.createElement("div");
		$(div).attr("id","tabPage");
		$(div).attr("class","text-right");
		
		$("#"+tab).after($(div));
	 
		laypage.render({
			elem: 'tabPage', //容器。值支持id名、原生dom对象，jquery对象。
			pages: totalPage, //通过后台拿到的总页数
			count:totalRow,
			curr: pageNumber || 1, //当前页
			groups: 5,//连续显示分页数
			skip: true, //是否开启跳页
			first:'首页',
			last:'尾页',
			//prev:'<',
			//next:'>',
			limit:pageSize,
			limits: [10,30, 50, 100],
			layout: ['count', 'prev', 'page', 'next', 'limit', 'refresh', 'skip'],
			jump: function(obj, first){ //触发分页后的回调
				//当前页码／总页码 共xxxx条记录
				if(!first){ //一定要加此判断，否则初始时会无限刷新(不是第一页就会执行)
					pageNumber = obj.curr;
					pageSize = obj.limit;
					if(typeof(eval(fn)) == "function") {
						var Str = "";
						if (arr != undefined){
							for (var i=0;i<arr.length;i++){
								if (arr[i] != undefined){
									Str += ",'" + arr[i] + "'";
								}
							}
						}
						eval(fn + "(" + pageNumber + "," + pageSize + Str + ")");
					}else{
						alert("该函数不存在");
					}
				}
				
			}
		});
	});
}

function simpleLayPage(tab,totalPage,totalRow,pageNumber,pageSize,fn,arr){
	layui.use(['laypage'], function(){
		var laypage = layui.laypage;
		
		$("#tabPage").remove();
		var div = document.createElement("div");
		$(div).attr("id","tabPage");
		$(div).attr("class","text-right");
		
		$("#"+tab).after($(div));
	 
		laypage.render({
			elem: 'tabPage', //容器。值支持id名、原生dom对象，jquery对象。
			pages: totalPage, //通过后台拿到的总页数
			count:totalRow,
			curr: pageNumber || 1, //当前页
			groups: 5,//连续显示分页数
			skip: true, //是否开启跳页
			first:'<<',
			last:'>>',
			//prev:'<',
			//next:'>',
			limit:pageSize,
			layout: ['count', '<', 'page', '>'],
			jump: function(obj, first){ //触发分页后的回调
				//当前页码／总页码 共xxxx条记录
				if(!first){ //一定要加此判断，否则初始时会无限刷新(不是第一页就会执行)
					pageNumber = obj.curr;
					pageSize = obj.limit;
					if(typeof(eval(fn)) == "function") {
						var Str = "";
						if (arr != undefined){
							for (var i=0;i<arr.length;i++){
								if (arr[i] != undefined){
									Str += ",'" + arr[i] + "'";
								}
							}
						}
						eval(fn + "(" + pageNumber + "," + pageSize + Str + ")");
					}else{
						alert("该函数不存在");
					}
				}
				
			}
		});
	});
}

/*弹出层*/
/*
	参数解释：
	title	标题
	url		请求的url
	id		需要操作的数据id
	w		弹出层宽度（缺省调默认值）
	h		弹出层高度（缺省调默认值）
*/
function layerOpen(title,url,w,h,action){
	layui.use(['layer'], function(){
		var layer = layui.layer;
		if (title == null || title == '') {
			title=false;
		};
		if (url == null || url == '') {
			url="404.html";
		};
		if (w == null || w == '') {
			w=800;
		};
		if (h == null || h == '') {
			h=($(window).height() - 150);
		};
		layer.open({
			type: 2,
			area: [w+'px', h +'px'],
			fix: false, //不固定
			maxmin: true,
			shade:0.5,
			title: title,
			scrollbar:false,
			content: [url,'no'],
			cancel: function(index, layero){
				if (action == "reload") {
					location.reload(); //刷新父页面
				}if (action == "reload_parent") {
					window.parent.location.reload(); //刷新父页面
				}
				return true;
			}
		});
	});
}

/*关闭弹出框口*/
function layer_close(refresh){
	var index = parent.layer.getFrameIndex(window.name);
	parent.layer.close(index);
	if(refresh == "1"){	//刷新当前页
		window.parent.location.reload();
	}else if(refresh == "2"){	//刷新父页面
		location.reload();
	}
}

//开始时间~结束时间
function layDate_start_end_dateTime(startId,endId){
		
	layui.use('laydate',function(){
		var laydate = layui.laydate;
		laydate.render({
			elem:'#'+startId,
			type: 'datetime',
			max:$("#"+endId).val()
		});
		laydate.render({
			elem:'#'+endId,
			type:'datetime',
			min:$("#"+startId).val()
		})
	
	})
	
}
